<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    console.log(miniConsole)
    var cache = [];
    var miniConsole = {
        log: function(){
            var args = arguments;
            cache.push( function(){
                return miniConsole.log.apply( miniConsole, args );
            });
        }
    };

    var handler = function( ev ){
        if ( ev.keyCode === 13 ){
            var script = document.createElement( 'script' );
            script.onload = function(){
                for ( var i = 0, fn; fn = cache[ i++ ]; ){
                    fn();
                }
            };
            script.src = 'js/MiniConsole.js';
            document.getElementsByTagName( 'head' )[0].appendChild( script );
        }
    };
    document.body.addEventListener( 'keydown', handler, false );
    // miniConsole.js 代码：
    miniConsole = {
        log: function(){
            // 真正代码略
            console.log( Array.prototype.join.call( arguments ) );
        }
    };
</script>


</body>
</html>